<%@page import="org.database.DatabaseTool"%>
<%@ page contentType="text/html;charset=UTF-8"%>
<jsp:useBean id="data" class="org.database.DatabaseTool" scope="application"/>
<html>
<head><title>Session 应用演示</title></head>
<% 
if (request.getParameter("username")!=null && request.getParameter("password")!=null)
{
String strName=request.getParameter("username");
String strPass=request.getParameter("password");
System.out.println(strName);
if (data.Vertifylogin(strName,strPass))
{
session.setAttribute("login","OK");
session.setAttribute("me",strName);
response.sendRedirect("/MyChat/servlet/MainServlet");

}
else
{
  out.print("<script>alert('请输入正确的账号和密码');document.location='/MyChat/servlet/UserServlet'</script>");
}
}else{
  out.print("<script>alert('账号或密码不能为空');document.location='/MyChat/servlet/UserServlet'</script>");
}
%>
</html>
